import React, { Component } from 'react';
import './index.css'
import axios from 'axios';
import Top from '../../components/Top';
import Banner from '../../components/Banner'
import FreeItem from '../../components/FreeItem';
class Free extends Component {
  constructor(props) {
    super(props);
    this.state = {
      list: [],
      name: '限免书',
      title1:'免费神书',
      title2:'午间一刻',
      title3:'黄金福利'
    }
  }
  componentDidMount() {
    axios.get('https://wxapi.chuangbie.com/wap/book/freebook').then(res => {
        this.setState({ list: res.data.data })
    })
}
  render() {
    const { list, name,title1,title2,title3 } = this.state
    return (
      <div>
        <Top name={name} history={this.props.history}/>
        <Banner data={list.banner} history={this.props.history}/>
        <FreeItem data={list.shenshu} title={title1} history={this.props.history}/>
        <FreeItem data={list.yike} title={title2} history={this.props.history}/>
        <FreeItem data={list.huangjin} title={title3} history={this.props.history}/>
        <div style={{height:'.2rem'}}></div>
      </div>
    );
  }
}

export default Free;